[SPARK-40733][SQL] Make the contents of SERDEPROPERTIES in the result of ShowCreateTableAsSerdeCommand have a fixed order#38238
Closed
LuciferYang wants to merge 1 commit intoapache:masterfrom
Closed
Conversation
Contributor
Author
|
Test first |
SERDEPROPERTIES in the ShowCreateTableAsSerdeCommand result have a fixed orderSERDEPROPERTIES in the result of ShowCreateTableAsSerdeCommand have a fixed order
LuciferYang
commented
Oct 13, 2022
| builder ++= s"ROW FORMAT SERDE '$serde'\n" | ||
|
|
||
| val serdeProps = conf.redactOptions(metadata.storage.properties).map { | ||
| val serdeProps = conf.redactOptions(metadata.storage.properties).toSeq.sortBy(_._1).map { |
Contributor
Author
There was a problem hiding this comment.
spark/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
Lines 1202 to 1210 in 1cb8250
showDataSourceTableOptions already do the similar work in #34753
dongjoon-hyun
approved these changes
Oct 13, 2022
Member
dongjoon-hyun
left a comment
There was a problem hiding this comment.
+1, LGTM. Thank you, @LuciferYang .
Merged to master for Apache Spark 3.4.0.
Contributor
Author
|
Thanks @dongjoon-hyun |
SandishKumarHN
pushed a commit
to SandishKumarHN/spark
that referenced
this pull request
Dec 12, 2022
…lt of `ShowCreateTableAsSerdeCommand` have a fixed order ### What changes were proposed in this pull request? This pr add a sort operation to make the contents of `SERDEPROPERTIES` in the result of `ShowCreateTableAsSerdeCommand` have a fixed order. ### Why are the changes needed? Improve Java version compatibility, make the results of `ShowCreateTableAsSerdeCommand` consistent when using Java version. Run the following command with Java 19: ``` mvn clean install -DskipTests -pl sql/hive -am mvn test -pl sql/hive -Dtest=none -DwildcardSuites=org.apache.spark.sql.hive.execution.command.ShowCreateTableSuite ``` There are 2 failed test: ``` - SHOW CREATE TABLE using Hive V1 catalog V1 command: hive table with serde info *** FAILED *** "... SERDEPROPERTIES ( '[serialization.format' = '1', 'field.delim' = ',', 'mapkey].delim' = ',') STORE..." did not equal "... SERDEPROPERTIES ( '[mapkey.delim' = ',', 'serialization.format' = '1', 'field].delim' = ',') STORE..." (ShowCreateTableSuite.scala:187) Analysis: "... SERDEPROPERTIES ( '[serialization.format' = '1', 'field.delim' = ',', 'mapkey].delim' = ',') STORE..." -> "... SERDEPROPERTIES ( '[mapkey.delim' = ',', 'serialization.format' = '1', 'field].delim' = ',') STORE..." - SHOW CREATE TABLE using Hive V1 catalog V2 command: hive table with serde info *** FAILED *** "... SERDEPROPERTIES ( '[serialization.format' = '1', 'field.delim' = ',', 'mapkey].delim' = ',') STORE..." did not equal "... SERDEPROPERTIES ( '[mapkey.delim' = ',', 'serialization.format' = '1', 'field].delim' = ',') STORE..." (ShowCreateTableSuite.scala:187) Analysis: "... SERDEPROPERTIES ( '[serialization.format' = '1', 'field.delim' = ',', 'mapkey].delim' = ',') STORE..." -> "... SERDEPROPERTIES ( '[mapkey.delim' = ',', 'serialization.format' = '1', 'field].delim' = ',') STORE..." ``` The content of `SERDEPROPERTIES` is correct, but the order is different from result running with Java 8/11/17. ### Does this PR introduce _any_ user-facing change? Yes, the `SERDEPROPERTIES` part of `ShowCreateTableAsSerdeCommand` results will be displayed in order by key. ### How was this patch tested? - Pass Git Hub Actions - Manual test: Run the following command with Java 19: ``` mvn clean install -DskipTests -pl sql/hive -am mvn test -pl sql/hive -Dtest=none -DwildcardSuites=org.apache.spark.sql.hive.execution.command.ShowCreateTableSuite ``` **Before** ``` - SHOW CREATE TABLE using Hive V1 catalog V1 command: hive table with serde info *** FAILED *** "... SERDEPROPERTIES ( '[serialization.format' = '1', 'field.delim' = ',', 'mapkey].delim' = ',') STORE..." did not equal "... SERDEPROPERTIES ( '[mapkey.delim' = ',', 'serialization.format' = '1', 'field].delim' = ',') STORE..." (ShowCreateTableSuite.scala:187) Analysis: "... SERDEPROPERTIES ( '[serialization.format' = '1', 'field.delim' = ',', 'mapkey].delim' = ',') STORE..." -> "... SERDEPROPERTIES ( '[mapkey.delim' = ',', 'serialization.format' = '1', 'field].delim' = ',') STORE..." - SHOW CREATE TABLE using Hive V1 catalog V2 command: hive table with serde info *** FAILED *** "... SERDEPROPERTIES ( '[serialization.format' = '1', 'field.delim' = ',', 'mapkey].delim' = ',') STORE..." did not equal "... SERDEPROPERTIES ( '[mapkey.delim' = ',', 'serialization.format' = '1', 'field].delim' = ',') STORE..." (ShowCreateTableSuite.scala:187) Analysis: "... SERDEPROPERTIES ( '[serialization.format' = '1', 'field.delim' = ',', 'mapkey].delim' = ',') STORE..." -> "... SERDEPROPERTIES ( '[mapkey.delim' = ',', 'serialization.format' = '1', 'field].delim' = ',') STORE..." ``` **After** ``` Run completed in 23 seconds, 930 milliseconds. Total number of tests run: 58 Suites: completed 2, aborted 0 Tests: succeeded 58, failed 0, canceled 0, ignored 0, pending 0 All tests passed. ``` Closes apache#38238 from LuciferYang/SPARK-40733. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This pr add a sort operation to make the contents of
SERDEPROPERTIESin the result ofShowCreateTableAsSerdeCommandhave a fixed order.Why are the changes needed?
Improve Java version compatibility, make the results of
ShowCreateTableAsSerdeCommandconsistent when using Java version.Run the following command with Java 19:
There are 2 failed test:
The content of
SERDEPROPERTIESis correct, but the order is different from result running with Java 8/11/17.Does this PR introduce any user-facing change?
Yes, the
SERDEPROPERTIESpart ofShowCreateTableAsSerdeCommandresults will be displayed in order by key.How was this patch tested?
Run the following command with Java 19:
Before
After